
<?php
		
	if(isset($_POST['confirmPurchase']))
	{
		$checkoutCartItem = new UserCartItem();

		$checkoutCartItem->setItem(0,$currentUser->id);
		try
		{
			$purchaseResult = $checkoutCartItem->purchaseItems($currentUser->creditcardNo);
			if($purchaseResult===true)
			{
				$cartMessage = '<span class="success_msg_span">Your purchase was successful.</span> Click <a href="product.php" title="Continue shopping">here</a> to continue shopping.';
			}
			else
			{
				$cartMessage = $purchaseResult;
			}
		}
		catch(Exception $ex)
		{
			$cartMessage = '<span class="failed_msg_span">'.$ex->getMessage().'</span>';
		}
	}
?>